<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2767：[JLOI2010]足彩投注   </title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[JLOI2010]足彩投注   </a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[JLOI2010]足彩投注   </span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [JLOI2010]足彩投注                   </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span lang="EN-US"><span style="mso-spacerun: yes"><font face="Times New Roman">&nbsp; </font></span></span><span style="font-family: 仿宋_GB2312; mso-ascii-font-family: 'Times New Roman'">南非世界杯离我们越来越近了，与足球有紧密联系的</span><span style="font-family: 仿宋_GB2312">足球彩票也越来越引起了人们的强烈关注。</span></span><span lang="EN-US" style="font-size: 12pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span lang="EN-US"><span style="mso-spacerun: yes"><font face="Times New Roman">&nbsp;&nbsp; </font></span></span><span lang="EN-US" style="font-family: 仿宋_GB2312"><span style="mso-spacerun: yes">&nbsp;</span></span><span style="font-family: 仿宋_GB2312">了解足球彩票的人可能知道，足球彩票中有一种游戏叫做&ldquo;胜负彩&rdquo;，意为猜比赛的胜负。下面是一些与胜负彩有关的术语：</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span lang="EN-US" style="font-family: 仿宋_GB2312"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><b style="mso-bidi-font-weight: normal"><span style="font-family: 仿宋_GB2312">注<span lang="EN-US"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></b><span style="font-family: 仿宋_GB2312">：每一组有效组合数据。</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span lang="EN-US" style="font-family: 仿宋_GB2312"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><b style="mso-bidi-font-weight: normal"><span style="font-family: 仿宋_GB2312">投<span lang="EN-US"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span>注</span></b><span style="font-family: 仿宋_GB2312">：彩民以现金购买足球彩票的行为。</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: medium"><b style="mso-bidi-font-weight: normal"><span style="font-family: 仿宋_GB2312">单式投注</span></b><span style="font-family: 仿宋_GB2312">：彩民对于所有球队的比赛成绩均只选择一种预测结果的投注方式。投注的数量（注数）为<span lang="EN-US">1</span>。</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: medium"><b style="mso-bidi-font-weight: normal"><span style="font-family: 仿宋_GB2312">复式投注</span></b><span style="font-family: 仿宋_GB2312">：彩民对于某些场次的比赛成绩选择两种以上的预测结果的投注方式。投注的数量为复式投注的组合数。例如，某彩民对一场比赛预测了两个结果（例如，胜平），另一场比赛预测了三个结果（胜负平），其他比赛都只预测了一种结果，那么注数就是<span lang="EN-US">2</span></span><span lang="EN-US" style="mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&times;</font></span><span lang="EN-US" style="font-family: 仿宋_GB2312">3 = 6</span><span style="font-family: 仿宋_GB2312">。这样的一个复式投注，可以看成一个包含六种单式投注的集合。</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span lang="EN-US" style="font-family: 仿宋_GB2312"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 仿宋_GB2312">胜负彩的玩法一般是这样的。彩票机构指定一轮比赛中的若干场，让彩民去猜每场比赛的结果（胜、负、平）。根据彩民猜中比赛的场次，来确定中奖的额度。</span></span><span lang="EN-US" style="font-size: 12pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: medium"><span style="font-family: 仿宋_GB2312">我们现在考虑一个简化的模型。对于一轮比赛，彩民需要竞猜其中<i style="mso-bidi-font-style: normal"><span lang="EN-US">n</span></i>场比赛的结果，每场比赛的胜负平都有一个概率<i style="mso-bidi-font-style: normal"><span lang="EN-US">p</span></i><span lang="EN-US">(<i style="mso-bidi-font-style: normal">i</i>, <i style="mso-bidi-font-style: normal">r</i>)</span>。其中，<i style="mso-bidi-font-style: normal"><span lang="EN-US">i</span></i>表示第<i style="mso-bidi-font-style: normal"><span lang="EN-US">i</span></i>场比赛。<i style="mso-bidi-font-style: normal"><span lang="EN-US">r</span></i><span lang="EN-US"> = 0, 1, 2</span>，分别表示比赛结果的（主队）负、平、胜。<i style="mso-bidi-font-style: normal"><span lang="EN-US">p</span></i><span lang="EN-US">(<i style="mso-bidi-font-style: normal">i</i>, <i style="mso-bidi-font-style: normal">r</i>)</span>则表示第<i style="mso-bidi-font-style: normal"><span lang="EN-US">i</span></i>场比赛、结果为<i style="mso-bidi-font-style: normal"><span lang="EN-US">r</span></i>的概率。此外，还有一个概率<i style="mso-bidi-font-style: normal"><span lang="EN-US">q</span></i><span lang="EN-US">(<i style="mso-bidi-font-style: normal">i</i>, <i style="mso-bidi-font-style: normal">r</i>)</span>，表示第<i style="mso-bidi-font-style: normal"><span lang="EN-US">i</span></i>场比赛，投注购买结果为<i style="mso-bidi-font-style: normal"><span lang="EN-US">r</span></i>的概率。</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: medium"><span style="font-family: 仿宋_GB2312">例如，如果<i style="mso-bidi-font-style: normal"><span lang="EN-US">q</span></i><span lang="EN-US">(1,0) = 0.5</span>，我们可以知道第一场比赛有<span lang="EN-US">50%</span>的投注会买主队输球。我们假设这<i style="mso-bidi-font-style: normal"><span lang="EN-US">n</span></i>场比赛互不相关，即<i style="mso-bidi-font-style: normal"><span lang="EN-US">p</span></i><span lang="EN-US">(<i style="mso-bidi-font-style: normal">i</i>, <i style="mso-bidi-font-style: normal">r</i>)</span>的结果不会受<i style="mso-bidi-font-style: normal"><span lang="EN-US">p</span></i><span lang="EN-US">(<i style="mso-bidi-font-style: normal">j</i>, <i style="mso-bidi-font-style: normal">r</i></span></span><span lang="EN-US" style="mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&rsquo;</font></span><span lang="EN-US" style="font-family: 仿宋_GB2312">)</span><span style="font-family: 仿宋_GB2312">的影响，<i style="mso-bidi-font-style: normal"><span lang="EN-US">q</span></i><span lang="EN-US">(<i style="mso-bidi-font-style: normal">i</i>, <i style="mso-bidi-font-style: normal">r</i>)</span>的结果也不会受<i style="mso-bidi-font-style: normal"><span lang="EN-US">q</span></i><span lang="EN-US">(<i style="mso-bidi-font-style: normal">j</i>, <i style="mso-bidi-font-style: normal">r</i></span></span><span lang="EN-US" style="mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&rsquo;</font></span><span lang="EN-US" style="font-family: 仿宋_GB2312">)</span><span style="font-family: 仿宋_GB2312">的影响（<i style="mso-bidi-font-style: normal"><span lang="EN-US">r</span></i><span lang="EN-US"> </span></span><span lang="EN-US" style="mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&ne;</font></span><span lang="EN-US" style="font-family: 仿宋_GB2312"> <i style="mso-bidi-font-style: normal">r</i></span><span lang="EN-US" style="mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&rsquo;</font></span><span style="font-family: 仿宋_GB2312">）。</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span lang="EN-US" style="font-family: 仿宋_GB2312"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: 仿宋_GB2312">在这个模型里，我们规定，必须猜中全部<i style="mso-bidi-font-style: normal"><span lang="EN-US">n</span></i>场比赛的结果才能获奖。总奖金为<i style="mso-bidi-font-style: normal"><span lang="EN-US">M</span></i>，由所有获奖的投注平分。<b style="mso-bidi-font-weight: normal">因此，对于一个单式投注<i style="mso-bidi-font-style: normal"><span lang="EN-US">R<sub>i</sub></span></i><span lang="EN-US"> = {<i style="mso-bidi-font-style: normal">r<sub>i</sub></i><sub>1</sub>, <i style="mso-bidi-font-style: normal">r<sub>i</sub></i><sub>2</sub>, </span></b></span><b style="mso-bidi-font-weight: normal"><span lang="EN-US" style="mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&hellip;</font></span></b><b style="mso-bidi-font-weight: normal"><span lang="EN-US" style="font-family: 仿宋_GB2312">, <i style="mso-bidi-font-style: normal">r<sub>in</sub></i>}</span></b><b style="mso-bidi-font-weight: normal"><span style="font-family: 仿宋_GB2312">，<i style="mso-bidi-font-style: normal"><span lang="EN-US">r<sub>ij</sub></span></i></span></b><span style="font-family: 仿宋_GB2312">表示投注<i style="mso-bidi-font-style: normal"><span lang="EN-US">R<sub>i</sub></span></i>对第<i style="mso-bidi-font-style: normal"><span lang="EN-US">j</span></i>场比赛的预测结果，它的中奖概率为：</span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p></o:p></span></span></p>
<p><img height="77" alt="" width="202" src="../file/2767_0.jpg" /></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: 12pt; font-family: 仿宋_GB2312">设投注总数为<i style="mso-bidi-font-style: normal"><span lang="EN-US">N</span></i>，那么中奖的投注总数为：<span lang="EN-US"><o:p></o:p></span></span></p>
<p><img height="80" alt="" width="257" src="../file/2767_1.jpg" /></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: 12pt; font-family: 仿宋_GB2312">于是，投注<i style="mso-bidi-font-style: normal"><span lang="EN-US">R<sub>i</sub></span></i>所能得到的奖金的期望（平均意义下能够获得的奖金数）就是：</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p><img height="74" alt="" width="171" src="../file/2767_2.jpg" /></o:p></span></span></p>
<p>
<p></p>
</p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 12pt; font-family: 仿宋_GB2312"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 12pt; font-family: 仿宋_GB2312">以上考虑的仅仅是单式投注的情况，即仅考虑单注<i style="mso-bidi-font-style: normal"><span lang="EN-US">R<sub>i</sub></span></i>的中奖情况。对于复式投注，情况要复杂一些。采用复式投注时，投注的是一个集合<i style="mso-bidi-font-style: normal"><span lang="EN-US">R</span></i><span lang="EN-US"> = {<i style="mso-bidi-font-style: normal">R</i><sub>1</sub>, <i style="mso-bidi-font-style: normal">R</i><sub>2</sub>, </span></span><span lang="EN-US" style="font-size: 12pt; mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&hellip;</font></span><span lang="EN-US" style="font-size: 12pt; font-family: 仿宋_GB2312">, <i style="mso-bidi-font-style: normal">R<sub>k</sub></i>}</span><span style="font-size: 12pt; font-family: 仿宋_GB2312">，其中<i style="mso-bidi-font-style: normal"><span lang="EN-US">k</span></i>是投注的数量。例如，三场比赛，第一场猜&ldquo;胜负&rdquo;，第二场猜&ldquo;平&rdquo;，第三场猜&ldquo;负平&rdquo;，则<i style="mso-bidi-font-style: normal"><span lang="EN-US">k</span></i><span lang="EN-US"> = 4</span>，<i style="mso-bidi-font-style: normal"><span lang="EN-US">R</span></i>集合如下：</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p><img height="115" alt="" width="194" src="../file/2767_3.jpg" /></o:p></span></span></p>
<p><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: 12pt; font-family: 仿宋_GB2312">复式投注<i style="mso-bidi-font-style: normal"><span lang="EN-US">R</span></i>中，只要有一个<i style="mso-bidi-font-style: normal"><span lang="EN-US">R<sub>i</sub></span></i>猜对所有比赛结果，即可中奖。因此，复式投注<i style="mso-bidi-font-style: normal"><span lang="EN-US">R</span></i>所能获得的奖金的期望就是：<img height="82" alt="" width="192" src="../file/2767_4.jpg" /></span></p>
<span style="font-size: 12pt; font-family: 仿宋_GB2312"><span lang="EN-US"><o:p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: 12pt; font-family: 仿宋_GB2312"><span style="mso-spacerun: yes">&nbsp;</span>我们的问题是，给定<i style="mso-bidi-font-style: normal"><span lang="EN-US">n</span></i>场比赛的信息（胜负平的概率和彩民购买三种结果的概率），以及复式投注中可以购买的最大注数<i style="mso-bidi-font-style: normal"><span lang="EN-US">U</span></i>，要求设计一种复式投注的方案，在不超过最大注数（复式投注的注数<i style="mso-bidi-font-style: normal"><span lang="EN-US">k</span></i><span lang="EN-US"> </span></span><span lang="EN-US" style="font-size: 12pt; mso-ascii-font-family: 仿宋_GB2312; mso-fareast-font-family: 仿宋_GB2312"><font face="Times New Roman">&le;</font></span><span lang="EN-US" style="font-size: 12pt; font-family: 仿宋_GB2312"> <i style="mso-bidi-font-style: normal">U</i></span><span style="font-size: 12pt; font-family: 仿宋_GB2312">）的前提下，使得获得奖金的期望最大。<span lang="EN-US"><o:p></o:p></span></span></p>
</o:p></span></span></span></span></p></p><hr/><h3>输入格式</h3><p><div><span style="font-size: 12pt">第一行四个整数<i>n, N, M, U</i>（<i>n</i>, <i>U</i> </span><span style="font-size: 12pt">&le;</span><span style="font-size: 12pt"> 10<sup>4</sup>, <i>N</i>, <i>M</i> </span><span style="font-size: 12pt">&le;</span><span style="font-size: 12pt"> 10<sup>9</sup></span><span style="font-size: 12pt">）。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">以下<i>n</i>行，每行六个实数。第<i>i</i> + 1行的六个实数为<i>p</i>(<i>i</i>, 0), <i>p</i>(<i>i</i>, 1), <i>p</i>(<i>i</i>, 2), <i>q</i>(<i>i</i>, 0), <i>q</i>(<i>i</i>, 1)和<i>q</i>(<i>i</i>, 2)，用来描述第<i>i</i>场比赛的相关信息。其中，<i>p</i>(<i>i</i>, 0) + <i>p</i>(<i>i</i>, 1) + <i>p</i>(<i>i</i>, 2) = 1, <i>q</i>(<i>i</i>, 0) + <i>q</i>(<i>i</i>, 1) + <i>q</i>(<i>i</i>, 2) = 1, <i>q</i>(<i>i</i>, <i>j</i>) </span><span style="font-size: 12pt">&ne;</span><span style="font-size: 12pt"> 0</span><span style="font-size: 12pt">。</span></div>
<div>&nbsp;</div></p><hr/><h3>输出格式</h3><p><div>&nbsp;</div>
<p><img height="177" alt="" width="447" src="../file/2767_0.jpg" /></p></p><hr/><h3>样例输入</h3><pre>1 10 10 1
0.3 0.2 0.5 0.7 0.2 0.1
</pre><hr/><h3>样例输出</h3><pre>1.609</pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2767" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2767" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>